<template>
  <div class="Breadcrumb">
    <el-breadcrumb separator="/" class="biaoqian">
      <el-breadcrumb-item :to="{ path: '/teacherInterface' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>教学基础信息</el-breadcrumb-item>
      <el-breadcrumb-item>班级查看</el-breadcrumb-item>
    </el-breadcrumb>
    <el-divider></el-divider>
  </div>
  <div class="showUnTicketInfo">
    <div class="box">
      <el-form :model="queryForm" size="middle" :inline="true" style="padding-left: 20px;  ">
        <el-form-item label="专业">
          <el-input v-model="queryForm.majorName" placeholder="请输入专业" clearable style="width: 240px;" />
        </el-form-item>
        <el-form-item label="班级名称">
          <el-input v-model="queryForm.name" placeholder="请输入班级名称" clearable style="width: 240px" />
        </el-form-item>
        <el-form-item label="年级">
          <el-input v-model="queryForm.grade" placeholder="请输入年级" clearable style="width: 240px" />
        </el-form-item>
        <el-form-item label="院系">
          <el-input v-model="queryForm.departmentName" placeholder="请输入院系" clearable style="width: 240px" />
        </el-form-item>
        <el-form-item>
          <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
              <el-button @click="handleSearch" type="primary" :icon="Search" size="mini">搜索</el-button>
            </el-col>
            <el-col :span="1.5">
              <el-button @click="handleReset" :icon="Refresh" size="mini">重置</el-button>
            </el-col>
          </el-row>
        </el-form-item>
      </el-form>
    </div>
    <div class="box-content">

    </div>
    <el-table v-model:data="dataList" height="450" style="width: 100%">
      <el-table-column label="年级" prop="grade" align="center" />
      <el-table-column label="专业" prop="majorName" :show-overflow-tooltip="true" align="center" />
      <el-table-column label="班级名称" prop="name" :show-overflow-tooltip="true" align="center" />
      <el-table-column label="人数" prop="studentCount" align="center" />
      <el-table-column label="院系" prop="departmentName" align="center">
      </el-table-column>
    </el-table>
    <div class="pagination">
      <el-pagination layout="prev, pager, next" :total=pageTotal :page-size="pageSize" v-model:current-page="curPage" />
    </div>
  </div>

</template>

<script>
import api from '@/api/api';
import { Delete, Edit, Search, Share, Upload, Refresh, Plus } from '@element-plus/icons-vue'

export default {
  mounted() {
    this.getData()
  },
  data() {
    return {
      dataList: [],
      curPage: 1,
      pageSize: 5,
      pageTotal: 0,
      queryForm: {
        'grade': '',
        'majorName': '',
        'name': '',
        'departmentName': '',
      },
    }
  },
  methods: {
    getData() {
      api.class_js.page(this.curPage, this.pageSize, this.queryForm.grade,
        this.queryForm.majorName, this.queryForm.name, this.queryForm.departmentName
      )
        .then((res) => {
          this.dataList = res.data.data.records
          this.pageTotal = res.data.data.total
        })
        .catch((err) => {
          console.log(err)
        })
    },
    handleSearch() {
      this.getData()
    },
    handleReset() {
      this.queryForm.grade = ''
      this.queryForm.majorName = ''
      this.queryForm.name = ''
      this.queryForm.departmentName = ''
      this.getData()
    },
  },
  watch: {
    curPage(newValue, oldValue) {
      this.getData()
    }
  },
  computed: {
    Search() {
      return Search
    },
    Refresh() {
      return Refresh
    },
    Plus() {
      return Plus
    },
    Edit() {
      return Edit
    },
    Delete() {
      return Delete
    }
  }


}
</script>

<style></style>